Skip to content

feat(truapi-debugger): loopback WebSocket server and web inspector - #537

Draft
decrypto21 wants to merge 1 commit into
nidish/debugger-2-enginefrom
nidish/debugger-3-standalone
Draft

feat(truapi-debugger): loopback WebSocket server and web inspector#537
decrypto21 wants to merge 1 commit into
nidish/debugger-2-enginefrom
nidish/debugger-3-standalone

Conversation

@decrypto21

Copy link
Copy Markdown
Contributor

Stacked on the engine PR. Design doc: #315.

The standalone inspector: a loopback WS + HTTP server the host dials, serving a Network-tab-style web inspector. Three files.

What

  • WS ingest — accepts the envelope the Rust sink and the web tee both send: v, codec, schema, channelId, product-vantage dir, base64 frame, dropped. Every refusal is counted and surfaced on /stats; a silently discarded envelope is indistinguishable from a host that never dialled.
  • HTTP endpoints as the contract/traces, /op-list, /stats, /op, /view, /frame. The page renders from these, and any other client (a script, curl, a headless check) goes through the same ones, so no two consumers can disagree.
  • Confinement — binds loopback; refuses the WS upgrade unless Origin is a loopback host (a cross-origin page can otherwise dial a loopback server and drive the decoder); rejects requests whose Host is not an exact loopback name (DNS rebinding); caps payload size. The Origin allowlist excludes the product sandbox realm, which is a legitimate origin for a page that dials in but must never be trusted to inject frames.

What it looks like

Aggregate summary strip, operation list with filter/sort/channel pills and health badges:

web-inspector

Opening an operation decodes every frame to its SCALE-typed value inline — no click-to-decode, no toggle, because a dev-only tool decodes everything by default:

frame-detail

Verification

tsc -b clean, 157 tests. The origin and Host gates are unit-tested separately from the server, across uppercase, trailing dots, punycode, IPv6, embedded credentials and integer IPv4 forms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant